package com.example.demo.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.config.jwt.JwtUtils;

@RestController
@RequestMapping("/admin")
public class AdminController {

	@GetMapping("/getUser")
	public String users(HttpServletRequest request) {
		String token = request.getHeader(JwtUtils.TOKEN_HEADER).replace(JwtUtils.TOKEN_PREFIX, "");
		return JwtUtils.getUsername(token);
	}
}
